try:
    from jose import JWT as jwt
except Exception:
    import jwt
import logging
errlog = logging.getLogger("err")
secret = "12345"


def jwt_encode(payload):
    return jwt.encode(payload, secret, algorithm="HS256")


def jwt_decode(token):
    return jwt.decode(token, secret, algorithms=["HS256"])


if __name__ == '__main__':
    payload = {
        "username": "admin",
        "password": "11111",
        "create_time": "111"
    }
    token = jwt_encode(payload)
    print(token)
